package com.ourteam.product.requirement.api;

import com.ourteam.frame.web.AbstractSearchModel;
import com.ourteam.product.requirement.dao.ProductRequirementFeatureRelateDAOQueryBean;
import com.ourteam.product.requirement.domain.ProductRequirementFeatureRelateBean;

public class ProductRequirementFeatureRelateSearchModel
		extends AbstractSearchModel<ProductRequirementFeatureRelateDAOQueryBean> {

	private long productFeatureId;

	private long productRequirementId;

	public long getProductFeatureId() {
		return productFeatureId;
	}

	public void setProductFeatureId(long productFeatureId) {
		this.productFeatureId = productFeatureId;
	}

	public long getProductRequirementId() {
		return productRequirementId;
	}

	public void setProductRequirementId(long productRequirementId) {
		this.productRequirementId = productRequirementId;
	}

	@Override
	public String getMappedDAOField(String aProperty) {
		return ProductRequirementFeatureRelateBean.getMappedDAOField(aProperty);
	}

	@Override
	protected void doBuildQueryBean(ProductRequirementFeatureRelateDAOQueryBean queryBean) throws Exception {

		ProductRequirementFeatureRelateDAOQueryBean.Criteria criteria = queryBean.createCriteria();

		if (productFeatureId != 0) {
			criteria.andProductFeatureIdEqualTo(productFeatureId);
		}

		if (productRequirementId != 0) {
			criteria.andProductRequirementIdEqualTo(productRequirementId);
		}
	}

}
